#ifndef GAMEGRAPHIC_H
#define GAMEGRAPHIC_H

#include <vector>

#include "util/Observer.hpp"
#include "util/Debug.hpp"

#include "Network/Client.hpp"

#include "GameEngine/GameEngine.hpp"
#include "GameEngine/Character.hpp"
#include "GameEngine/Shot.hpp"

#include "display/GameInfo.hpp"
#include "display/GraphicValue.hpp"
#include "display/Displayable.hpp"
#include "display/MainScreen.hpp"
#include "display/GameScreen.hpp"

#include "display/game/CharacterGraphic.hpp"
#include "display/game/ShotGraphic.hpp"
#include "display/game/MapGraphique.hpp"

class GameGraphic : public Displayable, Observer
{
    public:
        GameGraphic(ThreadDisplay * p_screenManager);
        virtual ~GameGraphic();

        Client* GetNetworkManager()		{ return m_networkManager; };

        virtual void draw(sf::RenderWindow*);
        virtual void DoEvent(sf::Event);
        virtual void DoRealTimeEvent(const sf::Input&);

        virtual void Notify(int code, void* parameter);

    protected:
    private:
        sf::Mutex* 						m_mutexPlayers;
        sf::Mutex* 						m_mutexShot;
        std::vector<CharacterGraphic*> 	m_players;
        std::vector<ShotGraphic*> 		m_shots;
        GameEngine* 					m_gameEngine;
        MapGraphique* 					m_map;
        Client *						m_networkManager;
        Character::Direction			m_directionV;
        Character::Direction			m_directionH;
        bool							m_displayScore;

        void InitGame			();

        void ChangeDirection	(int, int);

        void NewUser			(Character*);
        void DeleteUser			(Character*);

        void NewShot			(Shot*);
        void DeleteShot			(Shot*);

        void BackToMainScreen	();

        void DisplayScores		(sf::RenderWindow*);
        void DisplayScoreRow	(sf::RenderWindow*, int, sf::String*, sf::String*, sf::String*);

};

#endif // GAMEGRAPHIC_H
